import scrapy


class AutohomeSpider(scrapy.Spider):
    name = "autohome"
    allowed_domains = ["car.autohome.com.cn"]
    start_urls = ["https://car.autohome.com.cn/price/brand-15.html"]

    def parse(self, response):
        print("============")
        name_list = response.xpath('//div[@class="list-cont-main"]//a[@class="font-bold"]/text()')
        print(len(name_list))
        print(name_list.extract())

        print("============")
        # price_list: list[scrapy.selector.unified.Selector] = response.xpath('//span[@class="font-arial"]/text()')
        price_list = response.xpath('//span[@class="font-arial"]/text()')
        print(len(price_list))
        print(price_list.extract())
        print(price_list)

